function out = remBadRecs(in)
    global logStr
    out = in;
    badSiteID.indices = {~cellfun(@isnumeric, out.SiteID)};
    badFltDt.indices = {~cellfun(@isDateTime, out.FlightDatetime)};
    lose = [badSiteID.indices{:}] | [badFltDt.indices{:}];
    if any(lose)
        switch 1
            case ~any(badSiteID.indices{:}) % only some FlightDatetime's were bad
                logStr{end+1} = assembleMsg(out.CastGUID(badFltDt.indices{:}),...
                                            'FlightDatetime');
            case ~any(badFltDt.indices{:}) % only some SiteID's were bad
                logStr{end+1} = assembleMsg(out.CastGUID(badSiteID.indices{:}),...
                                            'SiteID');
            otherwise % some of each were bad (or we wouldn't have made it here)
                logStr{end+1} = assembleMsg(out.CastGUID(badSiteID.indices{:}),...
                                            'SiteID');
                logStr{end+1} = assembleMsg(out.CastGUID(badFltDt.indices{:}),...
                                            'FlightDatetime');
        end
        for field = fields(out)'
            field = field{:};
            out.(field) = out.(field)(~lose);
        end
    end
end

function msg = assembleMsg(badCastGUIDs, badField)
      switch numel(badCastGUIDs)
          case 1
              msg = sprintf([badField ' from CastGUID %s missing or wrong type; '...
                             'cast not processed.  '], badCastGUIDs{1});
          case 2
              msg = sprintf([badField ' from CastGUID''s %s and %s missing '...
                            'or wrong type; casts not processed.  '],...
                            badCastGUIDs{:});
          otherwise
              msg = sprintf([badField ' from CastGUID''s %s'], badCastGUIDs{1});
              msg = [msg sprintf(', %s', badCastGUIDs{2:end-1})];
              msg = [msg sprintf([', and %s missing or wrong type; '...
                     'casts not processed.  '], badCastGUIDs{end})];
      end
end